package com.chuangjiangx.member.stored.ddd.dal.mapper;

import com.chuangjiangx.member.basic.ddd.dal.dto.MemberHisStored;
import com.chuangjiangx.member.stored.ddd.dal.dto.*;
import com.chuangjiangx.member.stored.ddd.query.dto.StoredStreamDTO;
import com.chuangjiangx.member.stored.ddd.dal.condition.*;
import com.chuangjiangx.member.stored.ddd.dal.dto.AvailableBalance;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author LeeXyan
 * @Date 2018/1/22 16:08
 **/
public interface StoredStreamDalMapper {
    /**
     * 查询储值明细列表-H5
     */
    List<StoredStreamListForH5> queryStoredStreamListForH5(QueryStoredStreamListCondition condition);

    /**
     * 查询储值明细列表-客户端
     */
    List<StoredStreamListForClient> queryStoredStreamListForClient(QueryStoredListForClientCondition clientCondition, RowBounds rowBounds);

    /**
     * 查询当前会员储值明细列表-客户端
     */
    List<ClientStoredStreamList> queryClientStoredStreamList(QueryClientStoredListCondition condition, RowBounds rowBounds);

    /**
     * 查询储值明细列表-商户平台
     */
    List<StoredStreamListForMerchant> queryStoredStreamListForMerchant(QueryStoredListForMerchantCondition condition);

    /**
     * 查询储值明细列表数据总数-商户平台
     */
    Integer countStoredStreamListForMerchant(QueryStoredListForMerchantCondition condition);

    /**
     * 查询储值明细列表-商户平台（所有）
     */
    List<StoredStreamListForMerchant> queryStoredDetailListForMerchantAll(QueryStoredListForMerchantCondition condition);

    /**
     * 根据id查询储值明细详情-H5
     */
    StoredStreamInfoForH5 queryStoredStreamInfoForH5(@Param("id") Long id);

    /**
     * 根据id查询储值明细详情-客户端
     */
    StoredStreamInfoForClient queryStoredStreamInfoForClient(@Param("id") Long id);

    /**
     * 会员列表-储值账户-储值明细
     */
    List<StoredStreamForList> queryStoredDetailForList(StoredDetailForListCondition condition, RowBounds rowBounds);


    /**
     * 会员列表-储值账户-根据会员id查询储值
     */
    StoredValueAmount queryStoredValueByMemberIdAndMerchant(StoredValueAmountCondition condition);


    /**
     * 查询当前会员储值明细列表-商户平台
     */
    List<MerchantStoredStreamList> queryMerchantStoredStreamList(QueryMerchantStoredListCondition condition, RowBounds rowBounds);

    /**
     * 历史储值金额
     */
    BigDecimal queryHisStoredAmount(QueryStoredCondition queryStoredCondition);

    /**
     * 历史消费金额
     */
    BigDecimal queryHisConsumeAmount(QueryStoredCondition queryStoredCondition);

    /**
     * 历史退款金额
     */
    BigDecimal queryHisRefundAmount(QueryStoredCondition queryStoredCondition);

    /**
     * 历史赠送金额
     */
    BigDecimal queryHisGiftAmount(QueryStoredCondition queryStoredCondition);

    /**
     * 查询会员 历史消费，消费时间
     */
    List<MemberHisStored> queryMemberHisStored(@Param(value = "merchantId") Long merchantId, @Param(value = "memberId") Long memberId);

    /**
     * 查询会员 历史消费次数
     */
    int queryMemberHisStoredCount(@Param(value = "merchantId") Long merchantId, @Param(value = "memberId") Long memberId);

    StoredStreamDTO selectByMbrOrderIdAndType(@Param("orderId") Long orderId, @Param("type") Byte type);

    AvailableBalance queryAvailableBalance(@Param("pid") Long pid);

    AvailableBalance queryByOrderNum(AvailableBalanceCondition condition);
}
